/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbprodres")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbprodres.findAll", query = "SELECT p FROM Pyfntbprodres p"),
    @NamedQuery(name = "Pyfntbprodres.findByPyfntbprodresid", query = "SELECT p FROM Pyfntbprodres p WHERE p.pyfntbprodresid = :pyfntbprodresid"),
    @NamedQuery(name = "Pyfntbprodres.findByReferencia", query = "SELECT p FROM Pyfntbprodres p WHERE p.referencia = :referencia"),
    @NamedQuery(name = "Pyfntbprodres.findByNombre", query = "SELECT p FROM Pyfntbprodres p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pyfntbprodres.findByObservaciones", query = "SELECT p FROM Pyfntbprodres p WHERE p.observaciones = :observaciones")})
public class Pyfntbprodres implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbprodresid")
    private Integer pyfntbprodresid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "referencia")
    private String referencia;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbprodresid")
    private Collection<Pyfntbprogres> pyfntbprogresCollection;

    public Pyfntbprodres() {
    }

    public Pyfntbprodres(Integer pyfntbprodresid) {
        this.pyfntbprodresid = pyfntbprodresid;
    }

    public Pyfntbprodres(Integer pyfntbprodresid, String referencia, String nombre, String observaciones) {
        this.pyfntbprodresid = pyfntbprodresid;
        this.referencia = referencia;
        this.nombre = nombre;
        this.observaciones = observaciones;
    }

    public Integer getPyfntbprodresid() {
        return pyfntbprodresid;
    }

    public void setPyfntbprodresid(Integer pyfntbprodresid) {
        this.pyfntbprodresid = pyfntbprodresid;
    }

    public String getReferencia() {
        return referencia;
    }

    public void setReferencia(String referencia) {
        this.referencia = referencia;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public Collection<Pyfntbprogres> getPyfntbprogresCollection() {
        return pyfntbprogresCollection;
    }

    public void setPyfntbprogresCollection(Collection<Pyfntbprogres> pyfntbprogresCollection) {
        this.pyfntbprogresCollection = pyfntbprogresCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbprodresid != null ? pyfntbprodresid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbprodres)) {
            return false;
        }
        Pyfntbprodres other = (Pyfntbprodres) object;
        if ((this.pyfntbprodresid == null && other.pyfntbprodresid != null) || (this.pyfntbprodresid != null && !this.pyfntbprodresid.equals(other.pyfntbprodresid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbprodres[ pyfntbprodresid=" + pyfntbprodresid + " ]";
    }
    
}
